#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

vector<int> bubblesort(vector<int> arr){
    int round = 0;
    while (round != arr.size()-1){
        for (int i = arr.size()-1;i >round;--i){
            if (arr[i-1] > arr[i]){
                swap(arr[i-1],arr[i]);
            }

        }
      ++round;
    }
  return arr;  
}


int main(int argc, char const *argv[])
{
    vector<int> v {8, 5, 2, 9, 6, 3};
    auto sorted = bubblesort(v);
    for (auto n : sorted){
        cout<<n<<" ";
    }
    cout << endl; 
    return 0;
}

